Clinical statistics for non-statisticians: Day three

Steve Simon

Outline of the three day course

  • Day one: Numerical summaries and data visualization
  • Day two: Hypothesis testing and sampling
  • Day three: Statistical tests to compare treatment to a control and regression models

My goal: help you to become a better consumer of statistics

Day three topics

  • Statistical tests to compare a treatment to a control
    • What tests should you use for categorical outcomes?
    • What tests should you use for continuous outcomes?
    • When should you use nonparametric tests?

Day three topics (continued)

  • Regression models
    • How does a regression model quantify trends
    • How does logistic regression differ from linear regression
    • What is a confounding variable
    • How should you control for or adjust for confounding

Figure 1: Image of a passenger jet with four engines

Figure 2: Image of a passenger jet with one bad engine

Figure 3: Image of a passenger jet with two bad engines

Figure 4: Image of a passenger jet with three bad engines

Comparison of treatment and control

  • Treatment, something new to help a patient
    • Active intervention
    • Randomized trial
  • Exposure, something that a patient endures
    • Passive observation
    • Epidemiology study
  • Control
    • Placebo, or
    • Usual standard of care

Comparison of a binary outcome

\[X^2 = \Sigma \frac{(O_{ij}-E_{ij})^2}{E_{ij}}\]

Figure 5: Counts of dead and survived by sex with expected coutns

Alternative approach, the odds ratio

        Died  Survived
Females  154       308
Males    709       142

Survival odds for Females 2 to 1 in favor (308 / 154).
Survival odds for Males 5 to 1 against (142/ 709).

Odds ratio = (2/1) / (1/5) = 10

95% CI (7.7, 13)

Alternative approach, relative risk

        Died  Survived
Females  154       308
Males    709       142

Survival probability for 66.7%.
Survival probability for Males 16.7%.

Relative risk = 0.667 / 0.167 = 4

95% CI (3.4, 4.7)

Which is the better measure?

  • Two schools of thought
    • Relative risk is better
      • More natural interpretation
    • Odds ratio is better - Symmetric with respect to outcome
  • Cannot use relative risk for certain datasets

Both are inferior to absolute risk reduction

        Died  Survived
Females  154       308
Males    709       142

Survival probability for 66.7%.
Survival probability for Males 16.7%.

Absolute risk reduction = 0.667 - 0.167 = 0.5

95% CI (0.45, 0.55)

Comparison of multinomial outcome

  • Multinomial = 3 or more categories
  • Beyond the scope of this class
    • Multinomial logistic regression
    • Ordinal logistic regression

Comparison of a continuous outcome

  • Two cases
    • Independent (unpaired) samples
    • Paired samples

Two sample test

  • Is \((\bar{X_1}-\bar{X_2})\) close to zero?
  • How much sampling error?
    • \(S_p\sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\)

Comparison of ages of deaths/survivors

Mean ages 95% CI (-0.3, 3.8)

Paired samples

Room Before  After
 121   11.8   10.1
 125    7.1    3.8
 163    8.2    7.2
 218   10.1   10.5
 233   10.8    8.3
 264   14     12  
 324   14.6   12.1
 325   14     13.7

Average change

Room Before  After Change
 121   11.8   10.1   -1.7
 125    7.1    3.8   -3.3
 163    8.2    7.2   -1.0
 218   10.1   10.5    0.4
 233   10.8    8.3   -2.5
 264   14     12     -2.0
 324   14.6   12.1   -2.5
 325   14     13.7   -0.3  

\(\bar{D}=-1.61,\ S_D=1.24\)

95% CI (-2.65, -0.58)

Assumptions for t-tests

  • t-tests require two or more assumptions
    • Patients are independent
    • Outcome is normally distributed
    • For two sample t-test, equal variation

Nonparametric test

  • Uses ranks of the data
  • Does not rely on normality assumption
  • Does not rely on Central Limit Theorem

Wilcoxon signed rank test

                           Absolute
Room Before  After Change    Change   Rank
 121   11.8   10.1   -1.7       1.7      4
 125    7.1    3.8   -3.3       3.3      8
 163    8.2    7.2   -1.0       1.0      3
 218   10.1   10.5    0.4       0.4      2
 233   10.8    8.3   -2.5       2.5      6/7
 264   14     12     -2.0       2.0      5
 324   14.6   12.1   -2.5       2.5      6/7
 325   14     13.7   -0.3       0.3      1

p = 0.023

Criticisms of nonparametric tests

  • Not easy to get confidence intervals
  • Difficult to do risk adjustments

Figure 6: Quote from “Peggy Sue Got Married

Pop quiz

  • From high school algebra.
    • Pythagorean theorem
      • ?
    • Quadratic formula
      • ?
    • Equation for a straight line
      • ?

Pop quiz answers

  • From high school algebra.
    • Pythagorean theorem
      • \(a^2+b^2=c^2\)
    • Quadratic formula
      • \(\frac{-b \pm \sqrt{b^2-4ac}}{2a}\)
    • Formula for a straight line
      • \(y=mx+b\)

Equation of a straight line

  • \(y=mx+b\)
    • \(m=\) slope \(=\triangle y / \triangle x\)
    • \(b=\) y-intercept

In linear regression

  • y: dependent variable
  • x: independent variable
  • Slope: estimated average change in y when x increases by one unit.
  • Intercept: estimated average value of y when x equals zero.

Example: does mother’s age affect duration of breast feeding?

  • Study of breast feeding with pre-term infants
    • Difficulty: mother leaves hospital first

Figure 7: Scatterplot with regression line for age

Figure 8: Linear regression output

Figure 9: Linear regression output, slope

  • Slope = 0.4
    • The estimated average duration of breast feeding increases by 0.4 weeks for every increase of one year in the mother’s age.

Figure 10: Linear regression output, intercept

  • Intercept = 5.9
    • The estimated average duration of breast feeding is 5.9 weeks for a mother with age = 0.
    • Clearly an inappropriate extrapolation

Figure 11: Linear regression output, p-value

  • p-value=0.019
    • Reject the null hypothesis and conclude that there is a positive relationship between mother’s age and duration of breast feeding.

Figure 12: Linear regression output, confidence interval

  • 95% Confidence interval (0.066 to 0.71)
    • Note 6.626E-02 \(= 6.626 \times 10^{-2}\)
    • You are 95% confident that the true regression slope is positive.

Example: does treatment affect duration of breast feeding?

  • Both groups: encourage breast feeding when mom is in hospital
    • Intervention: feed infants through ng tube when mom is away
    • Control: Feeding using bottles when mom is away

Figure 13: Scatterplot with regression line for treatment=1

Figure 14: Linear regression output, treatment

Figure 15: Scatterplot with regression line for control=1

Linear regression with two independent variables

  • Intercept
  • Slope for first independent variable
  • Slope for second independent variable

Interpretation of intercept and slopes

  • Intercept: estimated average value of y when x1 and x2 both equal zero.
  • Slope for x1: estimated average change in y when x increases by one unit and x2 is held constant.
  • Slope for x2: similar interpretation

Adjusting for covariate imbalance

  • Covariate: variable not of direct interest in the research
    • but has to be accounted for to draw valid conclusions
  • Covariate imbalance: a difference in average levels of the covariate between treatment and control
    • Threat to the validity of the research
  • Example: average age of mothers
    • 25 in control group, 29 in treatment group
  • Covariate imbalance not quite same as confounding

Figure 16: Multiple linear regression output

Adjusted means

  • Unadjusted
    • Treatment: \(12.961 + 0.249 \times 29 = 20.2\)
    • Control: \(12.961 -5.972 + 0.249 \times 25 = 13.2\)
  • Adjusted
    • Treatment: \(12.961 + 0.249 \times 27 = 19.7\)
    • Control: \(12.961 -5.972 + 0.249 \times 27 = 13.7\)

Examples in the medical literature

Joke about prediction models

  • Risks during surgery
    • P[death] = 0.6
  • If risk doubles
    • P[death] = 1.2

Logistic regression

Figure 17: A linear trend in probability

prob BF = 4 + 2*GA

::: notes Let’s consider an artificial data example where we collect data on the gestational age of infants (GA), which is a continuous variable, and the probability that these infants will be breast feeding at discharge from the hospital (BF), which is a binary variable. We expect an increasing trend in the probability of BF as GA increases. Premature infants are usually sicker and they have to stay in the hospital longer. Both of these present obstacles to BF.

A linear model would presume that the probability of BF increases as a linear function of GA. You can represent a linear function algebraically as

prob BF = a + b*GA

This means that each unit increase in GA would add b percentage points to the probability of BF. The table shown below gives an example of a linear function.

This table represents the linear function

prob BF = 4 + 2*GA

which means that you can get the probability of BF by doubling GA and adding 4. So an infant with a gestational age of 30 would have a probability of 4+2*30 = 64.

A simple interpretation of this model is that each additional week of GA adds an extra 2% to the probability of BF. We could call this an additive probability model.

Figure 18: A bad linear trend in probability

Figure 19: Multiplicative trend in probabilities

Using odds

  • Three to one in favor of victory
    • Expect three wins for every loss
  • Four to one odds against victory
    • Expect four losses for every win
  • Odds = Prob / (1- Prob)
  • Prob = Odds / (Odds + 1)

Odds for winning election to U.S. president in 2024 - Biden: \(\frac{8/13}{1 + 8/13} = \frac{8}{21} = 0.381\) - Trump: \(\frac{1/3}{1 + 1/3} = \frac{1}{4} = 0.25\) - DeSantis: \(\frac{1/16}{1+1/16} = \frac{1}{17} = 0.059\)

Probability of winning 2022 World Cup

Brazil: 30.8%
Argentina: 18.2%
France: 16.7%
Spain: 13.3%
England: `10%
Portugal: 7.7%
Netherlands: 5.3%
Croatia: 2.8%

Brazil: \(\frac{0.308}{1-0.308} = .4451 \approx 4/9\)

Argentina: \(\frac{0.182}{1-0.182} = 0.2225 \approx 2/9\)

France: \(\frac{0.167}{1-0.167} = 0.2004 \approx 1/5\)

Switzerland: 1.5%
Japan: 1.5%
Morocco: 1.2%
USA: 1.1%
Senegal: 1%
South Korea: 0.67%
Poland: 0.55%
Australia: 0.5%

Odds against winning 2022 football World Cup

Brazil: 9 to 4
Argentina: 9 to 2
France: 5 to 1
Spain: 13 to 2
England: 9 to 1
Portugal: 12 to 1
Netherlands: 18 to 1
Croatia: 35 to 1
Switzerland: 65 to 1
Japan: 65 to 1
Morocco: 80 to 1
USA: 90 to 1
Senegal: 100 to 1
South Korea: 150 to 1
Poland: 180 to 1
Australia: 200 to 1

Figure 20: Multiplicative trend for odds

::: notes Let’s consider a multiplicative model for the odds (not the probability) of BF.

This model implies that each additional week of GA triples the odds of BF. A multiplicative model for odds is nice because it can’t produce any meaningless estimates.

Figure 21: Additive trend in log odds

Figure 22: Odds converted into probabilities

Figure 23: S-shaped curve

Figure 24: Actual data on gestational age

\(log odds = -16.72 + 0.577 \times ga\)

Figure 25: Predicted log odds

  • Let’s examine these calculations for GA = 30.
    • log odds = -16.72 + 0.577*30 = 0.59
    • odds = exp(0.59) = 1.80
    • prob = 1.80 / (1+1.80) = 0.643

Ratio of successive odds

1.01/0.57 = 1.78

1.80/1.01 = 1.78

3.20/1.80 = 1.78

5.70/3.20 = 1.78

Figure 26: Titanic probabilities for death and survival

Figure 27: Logistic regression for Titanic data

  • Female
    • log odds = 0.693
    • odds = 2
    • prob = 0.667
  • Male
    • log odds = 0.693 - 2.301 = -1.608
    • odds = 0.2003
    • prob = 0.167
  • log odds ratio = -2.301
    • odds ratio = 0.1